<?php
class Language {
	private static $default_language = "en";
	
	public static function get() {
		return (isset($_SESSION["language"])) ? $_SESSION["language"] : Language::$default_language;
	}
	
	public static function set($lang) {
		global $driver;
		global $dbinfo;
		global $params;
		$tr =& Translation2::factory($driver, $dbinfo, $params);
		$languages = $tr->getlangs('ids');
		
		if(!in_array($lang, $languages)) {
			return false;
		}
		
		$_SESSION["language"] = $lang;
		return true;
	}
}
?>
